package com.company.tips.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

public class Util {
	public static void close(Connection connect,Statement statement,ResultSet resultSet) {
		try {
			if (resultSet != null) {
				resultSet.close();
			}

			if (statement != null) {
				statement.close();
			}

			if (connect != null) {
				connect.close();
			}
		} catch (Exception e) {

		}
	}
	public static void close(Connection connect,PreparedStatement statement,ResultSet resultSet) {
		try {
			if (resultSet != null) {
				resultSet.close();
			}

			if (statement != null) {
				statement.close();
			}

			if (connect != null) {
				connect.close();
			}
		} catch (Exception e) {

		}
	}
	
	public static Connection getConnection() throws Exception{
		Class.forName(Const.DRIVER);
		// Setup the connection with the DB
		Connection connect = DriverManager
				.getConnection(Const.CONSTR);
		return connect;
	}
}
